<template>
	<view class="content poRel">
		<view class="wid100" style="height: 420rpx;">
			<swiper class="wh100" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
				<swiper-item v-for="(item,index) in list.swiper_img">
					<image :src="item" class="wh100" mode="aspectFill"></image>
				</swiper-item>
			</swiper>
		</view>
		<view class="wid90 mar" style="height: 182rpx;">
			<view class="hei20"></view>
			<view class="dis disAl disJuB hei60">
				<view class="fowe600 foSi35">{{list.name}}</view>
				<view class="foSi20 coFFF tim1" :style="'background-color: '+theme.seco_color+';'">{{list.duration}}分钟</view>
			</view>
			<view class="mar-top20 dis disAl disJuB">
				<view class="foSi25" style="vertical-align: bottom;color: #FF0000;">
					<span>¥</span>
					<span class="fowe600 foSi40">{{list.price}}</span>
					<span class="foSi20 mar-left10 poRel" style="color: #A6A6A6;">
						<span>¥</span>
						<span class="fowe600 foSi25">{{list.orig_price}}</span>
						<view class="wid100 poAbs" style="height: 1rpx;background-color: #A6A6A6;top: 40%;left: 0;"></view>
					</span>
				</view>
				<view class="foSi20" style="color: #878787;">{{list.all_sales}}人已预约</view>
			</view>
		</view>
		<view class="wid100 hei20" style="background-color: #E9E9E9;"></view>
		<view class="wid90 mar dis disAl" style="justify-content: space-around;height: 84rpx;">
			<view class="hei80 dis disAl" @click="xuanz(0)" :style="xuanze == 0?'border-bottom: 4rpx solid '+theme.main_color+';':'border-bottom: 4rpx solid #fff;'">项目介绍</view>
			<view class="hei80 dis disAl" @click="xuanz(1)" :style="xuanze == 1?'border-bottom: 4rpx solid '+theme.main_color+';':'border-bottom: 4rpx solid #fff;'">禁忌说明</view>
			<view class="hei80 dis disAl" @click="xuanz(2)" :style="xuanze == 2?'border-bottom: 4rpx solid '+theme.main_color+';':'border-bottom: 4rpx solid #fff;'">下单须知</view>
		</view>
		<view class="wid100 hei20" style="background-color: #E9E9E9;"></view>
		<!-- <view class="wid90 mar" style="padding: 30rpx 0;">
			<view class="dis disAl hei60 disJuB">
				<view class="fowe600 foSi30">用户好评</view>
				<view class="dis disAl foSi25">
					<view class="mar-right10">查看更多</view>
					<uni-icons type="right" size="25rpx"></uni-icons>
				</view>
			</view>
			<block v-for="(item,index) in 3" :key="index">
				<view class="mar-top30">
					<view class="dis disAl">
						<view class="hei80" style="width: 15%;">
							<image src="../../static/tu3.png" class="borRad50 hei100" style="width: 80rpx;"></image>
						</view>
						<view class="wid85">
							<view class="wid100 dis disAl disJuB">
								<view class="fowe600 foSi28 liH40">XXXX</view>
								<view class="foSi20" style="color: #878787;">2024.07.31</view>
							</view>
							<view class="mar-top10 dis disAl">
								<block v-for="(item1, index1) in 5" :key="index1">
									<uni-icons v-if="4 >= index1+1" type="star-filled" size="30rpx" color="#D81E06"></uni-icons>
									<uni-icons v-if="4 < index1+1" type="star" size="30rpx" color="#000000"></uni-icons>
								</block>
							</view>
						</view>
					</view>
					<view class="dis mar-top20">
						<view  style="width: 15%;"></view>
						<view class="liH40 webkitLineClamp foSi25 wid85">非常专业！非常专业！非常专业！非常专业！非常专业！非常专业！非常专业！非常专业！非常专业！非常专业！非常专业！</view>
					</view>
				</view>
				<view v-if="index+1 < 3" class="mar-top30" style="border-bottom: 1rpx solid #E5E5E5;"></view>
			</block>
		</view> -->
		<view class="wid100 hei20" style="background-color: #E9E9E9;"></view>
		<view v-if="xuanze == 0" class="wid90 mar">
			<view class="hei20"></view>
			<rich-text :nodes="list.content"></rich-text>
		</view>
		<view v-if="xuanze == 1" class="wid90 mar">
			<view class="hei20"></view>
			<rich-text :nodes="list.taboo"></rich-text>
		</view>
		<view v-if="xuanze == 2" class="wid90 mar">
			<view class="hei20"></view>
			<rich-text :nodes="list.order_notice"></rich-text>
		</view>
		<image v-if="list.length == 0" src="../../static/tu5.png" class="wid100" mode="widthFix"></image>
		<view style="height: 150rpx;"></view>
		<view class="poFix wid100 dis disAl disJuC bacFFF" style="height: 124rpx;border-top: 1rpx solid #878787;bottom: 0;">
			<view class="wid90 borRad40 dis disAl disJuC coFFF foSi35" @click="tiaozhuan('/pages/serve/technicianSelective?id='+id)"
				style="height: 85rpx;" :style="'background-color: '+theme.main_color+';'">选择技师</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: this.global.url,
				id: '',
				xuanze: 0,
				list: [],
				theme: null
			}
		},
		onLoad(option) {
			this.id = option.id
			this.theme = uni.getStorageSync('theme')
			this.getList()
		},
		methods: {
			xuanz(e){
				console.log(e);
				var that = this
				that.xuanze = e
			},
			getList(){
				var that = this
				uni.showLoading({
					title:'加载中...'
				})
				uni.request({
					url: that.global.url+'api/qianyu_smfw/service/infos',
					method: 'POST',
					header:{'site-id':that.global.site_id},
					data: {
						id: that.id
					},
					success(res) {
					    let result = res.data
					    if(result.code == 1){
							// 有style的写法
							var data = result.data
							data.content = data.content.replace(/<img/gi, "<img class='richImg'");
							data.taboo = data.taboo.replace(/<img/gi, "<img class='richImg'");
							data.order_notice = data.order_notice.replace(/<img/gi, "<img class='richImg'");
							console.log(data);
							that.list = data
					    }else{
					        uni.showToast({
					            title: result.msg,
					            icon:'none',
								duration: 2000
					        })
					    }
					},
					complete() {
						uni.hideLoading()
					}
				})
			},
			tiaozhuan(url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style>
	.tim1{
		padding: 15rpx;
		background-color: #00C82D;
		border-radius: 5rpx;
	}
	.butt2{
		width: 105rpx;
		height: 40rpx;
		background-color: #00C82D;
		border-radius: 5rpx;
	}
	.richImg {
	    width: 100% !important;
	    height: auto !important;
	}
</style>
